package com.cn.por.util;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;

public class StreamUtil {
	
	public static void main(String[] args) {
		Map<String,Double> a = new HashMap<String,Double>();
		a.put("1", 1D);
		a.put("2", 3D);
		a.put("3", 2D);
		
		int pageNo = 1;
    	int pageSize = 2;
    	List<Entry<String,Double>> endList = a.entrySet().stream().sorted(Map.Entry.comparingByValue())
		.collect(Collectors.toList());
    	Collections.reverse(endList);
    	List dd = endList.stream().skip((pageNo-1)*pageSize).limit(pageSize).collect(Collectors.toList());
		System.out.println(dd.toString());
	}

}
